package xyz.xtt.asset.vo;

import java.util.Objects;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xyz.xtt.asset.client.response.AssetVo;
import xyz.xtt.asset.entity.TblRemintAccount;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RemintAccountVo {
	private Long id;
	private String assetId;
	private String assetName;
	private String logoUri;
	private String description;
	private String goodsId;
	/**
	 * 拥有数量
	 */
	private Integer amount;

	public static RemintAccountVo create(TblRemintAccount remintAccount, AssetVo assetVo) {
		if (Objects.isNull(assetVo)) {
			return null;
		}
		return RemintAccountVo
				.builder()
				.id(remintAccount.getId())
				.amount(remintAccount.getAmount().intValue())
				.assetId(assetVo.getAssetId())
				.assetName(assetVo.getAssetName())
				.logoUri(assetVo.getLogoUri())
				.description(assetVo.getDescription())
				.goodsId(assetVo.getGoodsId())
				.build();

	}
}
